<template>
	<view class="container" v-if="show">
		<scroll-view  scroll-y="true" class="evaluate">
			<view class="item">
				<view class="label">申请项目：</view>
				<view class="content">{{item.project.name}}</view>
			</view>
			<view class="item">
				<view class="label">申请人：</view>
				<view class="content">{{item.username}}</view>
			</view>
			<view class="item">
				<view class="label">申请备注：</view>
				<view class="content">{{item.content}}</view>
			</view>
			<view class="item">
				<view class="label">业绩：</view>
				<view class="content">{{item.price}}</view>
			</view>
			<view class="item">
				<view class="label">可获积分：</view>
				<view class="content">{{item.score}}</view>
			</view>
			<view class="item">
				<view class="label">申请时间：</view>
				<view class="content">{{item.created_at | time}}</view>
			</view>
			<view class="item">
				<textarea class="textarea" name="" id=""  rows="3" placeholder="请输入审核备注" v-model="remark"></textarea>
			</view>
			<view class="op">
				<view class="btn cancel" @click="exam(3)">拒绝</view>
				<view class="btn agree" @click="exam(1)">同意</view>
			</view>
		</scroll-view>
		<view class="maskLayer" @click.stop="close"></view>
	</view>
</template>

<script>
	import {
			pass
		} from '@/api/merchant/order.js';
	import helper from '@/utils/helper.js';
	import moment from '@/utils/moment';
	export default {
		components: {},
		props: {

		},
		data() {
			return {
				show: false,
				item: {},
				current: 0,
				remark:''
			}
		},
		created() {
			this.getMember();
		},
		onReady() {
			
		},
		watch: {


		},
		filters: {
			// 时间格式化
			time(val) {
				return moment(val * 1000).format('YYYY-MM-DD HH:mm')
			},
			//转整
			toInt(val) {
				return helper.toInt(val);
			}
		},
		methods: {
			open(item={}) {
				this.show = true;
				this.item = item;
			},
			close() {
				this.show = false;
			},
			
			reset(){
				this.items = [];
			},
			search(){
				this.reset();
				this.getMember(true);
			},
			exam:function(state){
				var that = this;
				var param={
					id:this.item.id,
					remark:this.remark,
					state:state
				}
				uni.showLoading({
					title:'审核中'
				})
				this.$http.post(`${pass}`, param)
					.then(async data => {
						uni.hideLoading();
						if (data.code == 200) {
							var item = data.data;
							uni.showToast({
								title:'审核成功'
							})
							that.close();
							that.$emit('exam',item);
						}
					});
			},
		}
	}
</script>

<style lang="scss">
	.evaluate {
		background-color: #fff;
		position: fixed;
		width: 80%;
		z-index: 99;
		top: 10vh;
		max-height: 85vh;
		left: 10%;
		padding: 30rpx;
		border-radius: 20rpx;
		box-sizing: border-box;
		overflow: scroll;
		.item{
			display: flex;margin-bottom: 20rpx;
			.label{width: 160rpx;color: #999;}
			.textarea{border:1px solid #ececec;padding: 20rpx;border-radius: 10rpx;}
		}
		.op{
			display: flex;justify-content: space-between;margin: 30rpx 0;
			.btn{width: 45%;background-color: #ececec;border-radius: 10rpx;text-align: center;padding: 20rpx 0;}
			.agree{background-color: #0de241;color: #fff;}
		}
	}
</style>